﻿Imports System.Data.SqlClient
Public Class Employeeeditor
    Dim cmd As New SqlCommand
#Region "Code Connection"
    Public Sub connection()
        Try
            cn.ConnectionString = ("server=lomorng-pc;database=Resturant;UID=sa;PWD=123")
            cn.Open()
        Catch ex As Exception
        End Try
    End Sub
#End Region
    Private Sub Employeeeditor_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        condb()
    End Sub
#Region "Insert Data"
    Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnaddeditor.Click
        cmd.Connection = cn
        cmd.CommandText = "insert into Tblemployee values(N'" & txtname.Text & "',N'" & txtgender.Text & "',N'" & txtdob.Value & "',N'" & txtpob.Text & "',N'" & txtphon.Text & "', N'" & txtstartwork.Value & "',N'" & txtsalary.Text & "',N'" & txtphon.Text & "')"
        cmd.ExecuteNonQuery()
        Me.DialogResult = Windows.Forms.DialogResult.OK
    End Sub
#End Region

#Region "close Form"
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbnclose.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
    End Sub
#End Region
End Class